// 原型模式：
function createModule(str1, str2) {
    function Obj() {
        this.greeting = str1;
        this.name = str2;
    }

    Obj.prototype.sayIt = function () {
        return this.greeting + ", " + this.name;
    }
    return new Obj();
}

// 构造函数模式：
function createModule(str1, str2) {
    function Obj() {
        this.greeting = str1;
        this.name = str2;
        this.sayIt = function () {
            return this.greeting + ", " + this.name;
        }
    }

    return new Obj();
}

// 创建对象模式：
function createModule(str1, str2) {
    function CreateObj() {
        let obj = new Object;
        obj.greeting = str1;
        obj.name = str2;
        obj.sayIt = function () {
            return this.greeting + ", " + this.name;
        }
        return obj;
    }

    return CreateObj();
}

// 字面量模式：
function createModule(str1, str2) {
    const obj =
        {
            greeting: str1,
            name: str2,
            sayIt: function () {
                return this.greeting + ", " + this.name;
            }
        };
    return obj;
}